#include <iostream>
#include <string>

// 容器
#include <vector>

using namespace std;

struct stu
{
    string name;  // 名字
    string skill; // 技能
    int id;       // 学号
public:
    stu() {}
    stu(string name, string skill, int id) : name(name), skill(skill), id(id) {}

};

int main(int argc, char const *argv[])
{
    // 创建容器
    vector<stu> stu_v1;

    // 插入操作
    // push_back
    stu_v1.push_back(stu("唐三", "复活吧，我的爱人", 1));
    stu_v1.push_back(stu("萧炎", "佛怒火莲", 2));
    stu_v1.push_back(stu("林动", "大荒囚天指", 3));

    // insert 先创建迭代器
    vector<stu>::iterator it = stu_v1.begin();

    // advance(it , 2)
    it = it + 2;

    stu_v1.insert(it, stu("牧尘", "灵阵,起", 4));
    
    stu_v1.insert(it, stu("陈平安", "妈来",4));

    //遍历操作
    for(vector<stu>::iterator it = stu_v1.begin(); it != stu_v1.end() ; it++)
    {
        stu temp = *it;
        cout << "姓名：" << temp.name << "\t技能：" << temp.skill << "学号：" << temp.id << endl; 
    }

    //删除操作
    //尾删
    stu_v1.pop_back();
    cout << endl;

    for(vector<stu>::iterator it = stu_v1.begin(); it != stu_v1.end() ; it++)
    {
        stu temp = *it;
        cout << "姓名：" << temp.name << "\t技能：" << temp.skill << "\t学号：" << temp.id << endl; 
    }


    //删除操作
    cout << endl;
    it = stu_v1.begin();
    stu_v1.erase(it);

    for(vector<stu>::iterator it = stu_v1.begin(); it != stu_v1.end() ; it++)
    {
        stu temp = *it;
        cout << "姓名：" << temp.name << "\t技能：" << temp.skill << "\t学号：" << temp.id << endl; 
    }
    return 0;
}
